package com.zhejiangzhengyuan.municipal_pumping_station.controller;

import com.zhejiangzhengyuan.municipal_common.entity.PumpStation;
import com.zhejiangzhengyuan.municipal_common.entity.vo.PumpMonitoreVo;
import com.zhejiangzhengyuan.municipal_common.response.ResponseVo;
import com.zhejiangzhengyuan.municipal_common.service.PumpStationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author :linju
 * @create on : 2019/12/30
 */
@RestController
@Slf4j
@RequestMapping("/station/TimeMonitoreController")
@Api(tags = "泵站实时监控")
public class TimeMonitoreController {

    @Autowired private PumpStationService pumpStationService;


    @ApiOperation("查询实时监控泵站信息")
    @GetMapping("/getPumpMessage")
    public ResponseVo getPumpMessage() {
        List<PumpMonitoreVo> PumpEstimatedValues = pumpStationService.getPumpMessage();
        return ResponseVo.successWithData(PumpEstimatedValues);
    }

    @ApiOperation("查询实时监控雨污水处理终端")
    @GetMapping("/getPumpLiquidMessage")
    public ResponseVo getPumpLiquidMessage() {
        List<PumpStation> getPumpLiquidMessage = pumpStationService.getPumpLiquidMessage();
        return ResponseVo.successWithData(getPumpLiquidMessage);
    }

    @ApiOperation("更新实时监控泵站液位的报警阈值")
    @GetMapping("/updatePumpLiquidById")
    public ResponseVo updatePumpLiquidById(Long id,String value) {
        Integer i=pumpStationService.updatePumpLiquidById(id,value);
        return i>0? ResponseVo.SUCCESS:ResponseVo.SERVER_ERROR;
    }

}
